// let method={
// 	up:Symbol(),
// 	down:Symbol()
// }
// let game={
//
// };
// game[method.up]=function () {
// 	console.log("上升")
// }
// game[method.down]=function () {
// 	console.log("下降")
// }
// game[method.up]()
// let youxi={
// 	name:"狼人杀",
// 	[Symbol("say")]:function () {
// 		console.log("我可以发言")
// 	}
// }
// console.log(youxi)

class Array1 extends Array{
	static [Symbol.hasInstance](instance) {
		console.log("我被用来检测类型了")
		return Array.isArray(instance);
	}
}
console.log([] instanceof Array1);

let arr=[1,2,3,4,5],arr2=[6,7,8,9,10];
arr2[Symbol.isConcatSpreadable]=false;
console.log([...arr,...arr2])
// const a = new Array1(1, 2, 3);
// const mapped = a.map(x => x * x);

// console.log(mapped instanceof Array1);
// expected output: false

// console.log(mapped instanceof Array);
// expected output: true
const regexp1 = /foo/;
// console.log('/foo/'.startsWith(regexp1));
// expected output (Chrome): Error: First argument to String.prototype.startsWith must not be a regular expression
// expected output (Firefox): Error: Invalid type: first can't be a Regular Expression
// expected output (Safari): Error: Argument to String.prototype.startsWith cannot be a RegExp

regexp1[Symbol.match] = false;

console.log('/foo/'.startsWith(regexp1));
// expected output: true

// console.log('/baz/'.endsWith(regexp1));
// expected output: false
class Replace1 {
	constructor(value) {
		this.value = value;
	}
	[Symbol.replace](string) {
		console.log("字符串替换了")
		return `s/${string}/${this.value}/g`;
	}
}
console.log('foo'.replace(new Replace1('bar')));
